package com.usian.admin.job;

import com.usian.admin.feign.WmNewsFeign;
import com.usian.admin.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    private WmNewsFeign wmNewsFeign;
    @Autowired
    private WemediaNewsAutoScanService wemediaNewsAutoScanService;


    @XxlJob("newsScanJob")
    public ReturnT<String> scanJob(String param)throws Exception{

        //1:查询要发布的文章列表 feign
        List<Integer> list = wmNewsFeign.findRelease();
        for(Integer newsId:list ){
            //2:调用审核文章的方法
            wemediaNewsAutoScanService.NewsAutoScan(newsId);
        }
        return ReturnT.SUCCESS;
    }
}
